package com.woniuxy.businessassembly.dao;

import com.woniuxy.businessassembly.model.HotelRoom;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.hotel.form.RoomForm;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-05-24
 */
@Mapper
public interface HotelRoomMapper extends BaseMapper<HotelRoom> {


    @Insert("insert into hotel_room (room_id,hotel_id,room_date,room_type,room_feature,room_number,room_price,is_delay) values (#{roomId},#{hotelId},#{roomDate},#{roomType},#{roomFeature},#{roomNumber},#{roomPrice},#{isDelay})")
    int addNewRoom(HotelRoom hotelRoom);

    @Update("update hotel_room set room_id=#{roomId},hotel_id=#{hotelId},room_date=#{roomDate},room_type=#{roomType},room_feature=#{roomFeature},room_number=#{roomNumber},room_price=#{roomPrice},is_delay=#{isDelay}")
    int modifyRoom(HotelRoom hotelRoom);

    @Delete("delete from hotel_room where room_id=#{roomId}")
    int deleteRoom(Integer roomId);

    @Select("select * from hotel_room")
    List<HotelRoom> queryAllRooms();

    @Select("select * from hotel_room where room_feature=#{roomFeature}")
    List<HotelRoom> queryByFeature(String featrue);

    @Select("select * from hotel_room where room_type=#{roomType}")
    List<HotelRoom> queryByType(String type);

}
